package Threads.Utils;

import javax.swing.text.StyledEditorKit;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class log<T> {
    //带有当前线程名和时间的打印
    public static void debug(Object o){
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm:ss:SSS");
        LocalDateTime localDateTime=LocalDateTime.now();
        String format = dtf.format(localDateTime);
        String threadName = Thread.currentThread().getName();
        if (o instanceof String)
            System.out.println(format+" "+"["+threadName+"]"+"  "+(String)o);
        else if (o instanceof Boolean)
            System.out.println(format+" "+"["+threadName+"]"+"  "+((Boolean)o==true?"true":"false"));
    }

    public static void main(String[] args) {
        debug("nihao");
    }
}
